<?php
/**
 * 激活码模型
 * User: ws
 * Date: 2018/7/24
 * Time: 17:47
 */
namespace app\admin\model;
use think\Model;

class Code  extends Model
{
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;

    function add($params){
        $result = $this->isUpdate(false)->setAttr('code_id',null)->allowField(true)->save($params);
        if($result){
            return 1;
        }else{
            return false;
        }
    }

    function edit($params){
        $result = $this->isUpdate(true)->allowField(true)->save($params);
        if($result){
            return true;
        }else{
            return false;
        }
    }
}